/* eslint-disable no-unused-vars */
import React, { lazy, useState } from 'react'
import { HashRouter as Router, Route, Switch } from "react-router-dom";
import Home from '../views/Home'
import Menu from '../views/Menu'
import Print from '../views/Print';

export default function Index() {
  const [router, setRouter] = useState([
    {
      id: 1,
      path: '/',
      name: 'home',
      component: Home,
      exact: true
    },
    {
      id: 2,
      path: "/print/:orderid",
      name: "print",
      component: Print
    },
    {
      id: 3,
      path: '/menu',
      name: "menu",
      component: Menu,
    }
  ])
  return (
      <Router>
        <Switch>
          {router.map((item) => {
            return (
              <Route
                key={item.id}
                path={item.path}
                component={item.component}
                exact={item.exact}
              ></Route>
            );
          })}
        </Switch>
      </Router>
  )
}
